<template>
	<view class="fwpj">
		<view class="evaluate">
			<view class="evals">
				<view class="top">
					<view class="txt_top">
						累计收到的评价总数：
					</view>
					<view class="num_top">
						{{evalSum.totalCount}}
					</view>
				</view>
				<view class="xian"></view>
				<view class="bottom">
					<view class="eval">
						<view class="evalimg">
							<image src="/static/image/server/20.png" mode=""></image>
						</view>
						<view class="pj">差评：</view>
						<view class="num_eval">{{evalSum.lowCount}}</view>
					</view>
					<view class="eval">
						<view class="evalimg">
							<image src="/static/image/server/21.png" mode=""></image>
						</view>
						<view class="pj">中评：</view>
						<view class="num_eval">{{evalSum.midCount}}</view>
					</view>
					<view class="eval">
						<view class="evalimg">
							<image src="/static/image/server/22.png" mode=""></image>
						</view>
						<view class="pj">好评：</view>
						<view class="num_eval">{{evalSum.highCount}}</view>
					</view>
				</view>
			</view>
		</view>

		<view class="eval_list" v-for="(item,index) in evalList" :key="index">
			<view class="items">
				<view class="user_eval">匿名用户</view>
				<view class="xian"></view>
				<view class="eval_item" v-if="item.serviceComment != ''">{{item.serviceComment}}</view>
				<view class="eval_item">暂无评价</view>
				<view class="eval_all">
					<view class="eval_b">
						综合评价：
					</view>
					<view class="eval_a">
						<view class="a_image">
							<image v-if="item.levelComment == 1" src="../../../static/image/shop/17-2.png" mode="">
							</image>
							<image v-else src="../../../static/image/shop/17-1.png" mode=""></image>
						</view>
						<view class="pj_a"> 差评</view>
					</view>
					<view class="eval_a">
						<view class="a_image">
							<image v-if="item.levelComment == 2" src="../../../static/image/shop/17-2.png" mode="">
							</image>
							<image v-else src="../../../static/image/shop/17-1.png" mode=""></image>
						</view>
						<view class="pj_a"> 中评</view>
					</view>
					<view class="eval_a">
						<view class="a_image">
							<image v-if="item.levelComment == 3" src="../../../static/image/shop/17-2.png" mode="">
							</image>
							<image v-else src="../../../static/image/shop/17-1.png" mode=""></image>
						</view>
						<view class="pj_a"> 好评</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $http from "@/ajax/http.js"
	export default {
		data() {
			return {
				evalSum: [],

				evalList: []
			}
		},
		onLoad() {
			this.getRecCommentList();
			this.getCommentCount();
		},
		methods: {
			getCommentCount() {
				$http.request({
					url: "/waiter/my/getCommentCount",
					method: "GET"
				}).then((res) => {
					console.log(res, "统计数据");
					this.evalSum = res
				})
			},

			getRecCommentList() {
				$http.request({
					url: "/waiter/my/getRecCommentList",
					method: "GET"
				}).then((res) => {
					console.log(res, "收到的列表评价");
					this.evalList = res
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.fwpj {
		display: flex;
		align-items: center;
		flex-direction: column;
		background: linear-gradient(to top, RGBA(2, 81, 84, 1), RGBA(18, 145, 157, 1));
	}

	.evaluate {
		width: 677rpx;
		height: 198rpx;
		background: linear-gradient(to bottom right, rgba(19, 183, 163, 1), rgba(0, 130, 140, 1));
		border-radius: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		.evals {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			width: 595rpx;
			height: 116rpx;

			.top {
				width: 595rpx;
				display: flex;
				justify-content: space-between;

				.txt_top {
					font-weight: 500;
					font-size: 26rpx;
					color: #FFFFFF;
				}

				.num_top {
					font-weight: 600;
					font-size: 32rpx;
					color: #FFFFFF;
				}
			}

			.xian {
				width: 595rpx;
				height: 1rpx;
				background-color: #43adad;
			}

			.bottom {
				display: flex;
				flex-direction: row;
				justify-content: space-between;

				.eval {
					display: flex;
					flex-direction: row;
					height: 27rpx;

					image {
						width: 27rpx;
						height: 27rpx;
					}

					.pj {
						font-weight: 400;
						font-size: 24rpx;
						color: #FFFFFF;
						line-height: 35rpx;
						margin-left: 15rpx;
					}

					.num_eval {
						font-weight: 600;
						font-size: 24rpx;
						color: #FFFFFF;
						line-height: 35rpx;
					}
				}
			}
		}

	}

	.eval_list {
		width: 677rpx;
		height: 233rpx;
		background-color: #FFFFFF;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 20rpx;
		margin-top: 23rpx;

		.items {
			display: flex;
			justify-content: space-between;
			flex-direction: column;
			width: 590rpx;
			height: 179rpx;

			.user_eval {
				font-weight: 400;
				font-size: 22rpx;
				color: #4C4948;
			}

			.xian {
				height: 1rpx;
				background-color: #cfcfcf;
			}

			.eval_item {
				font-weight: bold;
				font-size: 24rpx;
				color: #3E3A39;
			}

			.eval_all {
				width: 404rpx;
				font-weight: 400;
				font-size: 22rpx;
				color: #7D7D7D;
				display: flex;
				flex-direction: row;
				justify-content: space-between;

				.eval_a {
					display: flex;
					flex-direction: row;

					image {
						width: 21rpx;
						height: 21rpx;
					}
				}
			}
		}

	}
</style>